echo "################ DOWNLOAD ZendLoader"
cd /usr/local
wget -c http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
tar -zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
cd /var/www
ln -s /usr/local/ZendGuardLoader-php-5.3-linux-glibc23-x86_64 ZendLoader

echo "################ SET PHP"
echo "date.timezone = \"Asia/Shanghai\"" >> /etc/php.ini
echo "zend_extension=/var/www/ZendLoader/php-5.3.x/ZendGuardLoader.so" >> /etc/php.ini
echo "zend_loader.enable=1" >> /etc/php.ini
echo "zend_loader.disable_licensing=0" >> /etc/php.ini
echo "zend_loader.obfuscation_level_support=3" >> /etc/php.ini

echo "################ SET SYS"

cat /proc/sys/fs/file-max

echo "fs.file-max = 65536" >> /etc/sysctl.conf
sysctl -p

echo "*    -    nofile    65536" >> /etc/security/limits.conf
ulimit -HSn 65536
 

echo "################ CONFIRGURE"

mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
mv /etc/nginx/conf.d/virtual.conf /etc/nginx/conf.d/virtual.conf.bak

cd /etc/nginx
echo "------------ COPY nginx.conf"
cp /lin/nginx.conf /etc/nginx/nginx.conf
cp /lin/site_ktapp.conf /etc/nginx/conf.d/site_ktapp.conf

echo "/lin/n_res.sh" >> /etc/rc.local

echo "################ PLEASE TRY START"

